<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <button v-permission="{action:'add'}"></button>
    </div>
    <script type="text/javascript" src="js/vue.js"></script>
    <script type="text/javascript">
        /*
                                                                                                      实现自定义指令v-permission, 让使用这条指令的元素, 可以将其内容设置为action所指明的字符串
                                                                                                    */
        // Vue.directive('permission', {
        //     inserted: function(el, binding) {
        //         el.innerHTML = binding.value.action
        //     }
        // })
        var vm = new Vue({
            el: '#app',
            data: {

            },
            methods: {},
            directives: {
                permission: {
                    inserted: function(el, binding) {
                        console.log(el);
                        console.log(binding);

                        el.innerHTML = binding.value.action
                    }
                }
            }
        });
    </script>
</body>

</html>